GBML manual / Tweens

tween_running

True while a glide started with tween_to or tween_from_to is still moving this variable, false once it has arrived, was stopped, or never started.

Works differently on Game Boy - The Game Boy glides up to 8 variables at once (the Advance 16), in 32 steps of the curve, over a distance of less than 1,024; a ninth jumps to its end value as the Advance's does when its places are full.

Works differently on Game Boy Color - The Game Boy Color glides up to 8 variables at once (the Advance 16), in 32 steps of the curve, over a distance of less than 1,024; a ninth jumps to its end value as the Advance's does when its places are full.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

tween_running(target) -> bool

Arguments

NameType
targetfield

Returns

bool

Description

true while a glide started with tween_to or tween_from_to is still moving this variable. false once it has arrived, was stopped, or never started.

Example

if (!tween_running(x)) {
    tween_to(x, 200 - x, 40, EASE_SINE_IN_OUT);
}

Each time the slide ends, a new one starts that carries the walker to the mirror place on the other side of 100. Nothing starts while one is still going.

Good to know

On the GBA

Use it to wait for a move to finish before starting the next one: `if (!tween_running(x)) { ... }`. A glide that could not start because every place was busy has already jumped to its end, so it reads false. A destroyed instance reads false.

See also: Tweenstween_totween_stoptween_count